<template>
    <el-dialog
      v-model="isShow"
      :title="title"
      width="480"
      :close-on-click-modal="false"
      @close="handleClose"
    >
        <el-form class="dialog-form" label-width="100px">
        <el-row :gutter="20">
            <el-col :xs="24">
            <el-form-item label="审核：">
                <el-radio-group v-model="form.status">
                <el-radio :label="2">同意</el-radio>
                <el-radio :label="3">拒绝</el-radio>
                </el-radio-group>
            </el-form-item>
            </el-col>
            <!-- <el-col :xs="24">
            <el-form-item label="备注：">
                <el-input v-model="form.remarks" placeholder="请输入" type="textarea" />
            </el-form-item>
            </el-col> -->
        </el-row>
        </el-form>
        <template #footer>
        <span class="dialog-footer">
            <el-button @click="isShow = false">取消</el-button>
            <el-button type="primary" :loading="btnLoading" @click="submitForm">确定</el-button>
        </span>
        </template>  
    </el-dialog>
  </template>
  
  <script setup lang="ts">
  import {ElMessage, ElMessageBox} from 'element-plus'
  import { ref, reactive, inject, getCurrentInstance, ComponentInternalInstance } from 'vue';
  const {proxy} = getCurrentInstance() as ComponentInternalInstance;
  let optionData:any = inject('optionData'); 
  const emit = defineEmits(['confirm']);
  let isShow = ref(false);
  let title = ref('活动审核');
  let btnLoading = ref(false);
  let row:any = reactive({});
  let form = reactive({
    status: 2,
  })
  const init = (data:any) => {
    row = data;
    isShow.value = true;
  };
  const handleClose = () => {
    
  }
  const submitForm = () => {
    btnLoading.value = true;
    proxy.$request('put', '/admin/activities/'+ row.id +'/status?status=' + form.status, {}, (data,msg) => {
        btnLoading.value = false;
        isShow.value = false;
        emit('confirm');
    }, msg => {
        btnLoading.value = false;
    })
  }
  
  defineExpose({
    init,
  })
  </script>
  
  <style>
  
  </style>